<html>
<head>
  <title>../ex4.c</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<a href="../ex4.c">download the original source code</a>.
<pre>
<a name="line1">   1</a> <font color="#444444">/*
<a name="line2">   2</a>    Example 4
<a name="line3">   3</a> 
<a name="line4">   4</a>    Interface:      Structured interface (Struct)
<a name="line5">   5</a> 
<a name="line6">   6</a>    Compile with:   make ex4
<a name="line7">   7</a> 
<a name="line8">   8</a>    Sample run:     mpirun -np 16 ex4 -n 33 -solver 10 -K 3 -B 0 -C 1 -U0 2 -F 4
<a name="line9">   9</a> 
<a name="line10">  10</a>    To see options: ex4 -help
<a name="line11">  11</a> 
<a name="line12">  12</a>    Description:    This example differs from the previous structured example
<a name="line13">  13</a>                    (Example 3) in that a more sophisticated stencil and
<a name="line14">  14</a>                    boundary conditions are implemented. The method illustrated
<a name="line15">  15</a>                    here to implement the boundary conditions is much more general
<a name="line16">  16</a>                    than that in the previous example.  Also symmetric storage is
<a name="line17">  17</a>                    utilized when applicable.
<a name="line18">  18</a> 
<a name="line19">  19</a>                    This code solves the convection-reaction-diffusion problem
<a name="line20">  20</a>                    div (-K grad u + B u) + C u = F in the unit square with
<a name="line21">  21</a>                    boundary condition u = U0.  The domain is split into N x N
<a name="line22">  22</a>                    processor grid.  Thus, the given number of processors should
<a name="line23">  23</a>                    be a perfect square. Each processor has a n x n grid, with
<a name="line24">  24</a>                    nodes connected by a 5-point stencil. Note that the struct
<a name="line25">  25</a>                    interface assumes a cell-centered grid, and, therefore, the
<a name="line26">  26</a>                    nodes are not shared.
<a name="line27">  27</a> 
<a name="line28">  28</a>                    To incorporate the boundary conditions, we do the following:
<a name="line29">  29</a>                    Let x_i and x_b be the interior and boundary parts of the
<a name="line30">  30</a>                    solution vector x. If we split the matrix A as
<a name="line31">  31</a>                              A = [A_ii A_ib; A_bi A_bb],
<a name="line32">  32</a>                    then we solve
<a name="line33">  33</a>                              [A_ii 0; 0 I] [x_i ; x_b] = [b_i - A_ib u_0; u_0].
<a name="line34">  34</a>                    Note that this differs from the previous example in that we
<a name="line35">  35</a>                    are actually solving for the boundary conditions (so they
<a name="line36">  36</a>                    may not be exact as in ex3, where we only solved for the
<a name="line37">  37</a>                    interior).  This approach is useful for more general types
<a name="line38">  38</a>                    of b.c.
<a name="line39">  39</a> 
<a name="line40">  40</a>                    A number of solvers are available. More information can be
<a name="line41">  41</a>                    found in the Solvers and Preconditioners chapter of the
<a name="line42">  42</a>                    User's Manual.
<a name="line43">  43</a> 
<a name="line44">  44</a>                    We recommend viewing examples 1, 2, and 3 before viewing this
<a name="line45">  45</a>                    example.
<a name="line46">  46</a> */</font>
<a name="line47">  47</a> 
<a name="line48">  48</a> <font color="0000ff"><strong>#include <font color="#008000">&lt;math.h&gt;</font></strong></font>
<a name="line49">  49</a> <font color="0000ff"><strong>#include <font color="#008000">&quot;_hypre_utilities.h&quot;</font></strong></font>
<a name="line50">  50</a> <font color="0000ff"><strong>#include <font color="#008000">&quot;HYPRE_krylov.h&quot;</font></strong></font>
<a name="line51">  51</a> <font color="0000ff"><strong>#include <font color="#008000">&quot;HYPRE_struct_ls.h&quot;</font></strong></font>
<a name="line52">  52</a> 
<a name="line53">  53</a> <font color="0000ff"><strong>#ifdef M_PI</strong></font>
<a name="line54">  54</a> <font color="0000ff"><strong>  #define PI M_PI</strong></font>
<a name="line55">  55</a> <font color="0000ff"><strong>#else</strong></font>
<a name="line56">  56</a> <font color="0000ff"><strong>  #define PI 3.14159265358979</strong></font>
<a name="line57">  57</a> <font color="0000ff"><strong>#endif</strong></font>
<a name="line58">  58</a> 
<a name="line59">  59</a> <font color="0000ff"><strong>#include <font color="#008000">&quot;vis.c&quot;</font></strong></font>
<a name="line60">  60</a> 
<a name="line61">  61</a> <font color="#444444">/* Macro to evaluate a function F in the grid point (i,j) */</font>
<a name="line62">  62</a> <font color="0000ff"><strong>#define Eval(F,i,j) (F( (ilower[0]+(i))*h, (ilower[1]+(j))*h ))</strong></font>
<a name="line63">  63</a> <font color="0000ff"><strong>#define bcEval(F,i,j) (F( (bc_ilower[0]+(i))*h, (bc_ilower[1]+(j))*h ))</strong></font>
<a name="line64">  64</a> 
<a name="line65">  65</a> <strong>int</strong> <font color="#2040a0">optionK</font>, <font color="#2040a0">optionB</font>, <font color="#2040a0">optionC</font>, <font color="#2040a0">optionU0</font>, <font color="#2040a0">optionF</font><font color="4444FF">;</font>
<a name="line66">  66</a> 
<a name="line67">  67</a> <font color="#444444">/* Diffusion coefficient */</font>
<a name="line68">  68</a> <strong>double</strong> <font color="#2040a0">K</font><font color="4444FF">(</font><strong>double</strong> <font color="#2040a0">x</font>, <strong>double</strong> <font color="#2040a0">y</font><font color="4444FF">)</font>
<a name="line69">  69</a> <font color="4444FF"><strong>{</strong></font>
<a name="line70">  70</a>    <strong>switch</strong> <font color="4444FF">(</font><font color="#2040a0">optionK</font><font color="4444FF">)</font>
<a name="line71">  71</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line72">  72</a>       <strong>case</strong> <font color="#FF0000">0</font><font color="4444FF">:</font>
<a name="line73">  73</a>          <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line74">  74</a>       <strong>case</strong> <font color="#FF0000">1</font><font color="4444FF">:</font>
<a name="line75">  75</a>          <strong>return</strong> <font color="#2040a0">x</font><font color="4444FF">*</font><font color="#2040a0">x</font><font color="4444FF">+</font><font color="#2040a0">exp</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line76">  76</a>       <strong>case</strong> <font color="#FF0000">2</font><font color="4444FF">:</font>
<a name="line77">  77</a>          <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">fabs</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0.25</font><font color="4444FF">)</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="4444FF">(</font><font color="#2040a0">fabs</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0.25</font><font color="4444FF">)</font><font color="4444FF">)</font>
<a name="line78">  78</a>             <strong>return</strong> <font color="#FF0000">100.0</font><font color="4444FF">;</font>
<a name="line79">  79</a>          <strong>else</strong>
<a name="line80">  80</a>             <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line81">  81</a>       <strong>case</strong> <font color="#FF0000">3</font><font color="4444FF">:</font>
<a name="line82">  82</a>          <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">*</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">*</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0.0625</font><font color="4444FF">)</font>
<a name="line83">  83</a>             <strong>return</strong> <font color="#FF0000">10.0</font><font color="4444FF">;</font>
<a name="line84">  84</a>          <strong>else</strong>
<a name="line85">  85</a>             <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line86">  86</a>       <strong>default</strong><font color="4444FF">:</font>
<a name="line87">  87</a>          <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line88">  88</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line89">  89</a> <font color="4444FF"><strong>}</strong></font>
<a name="line90">  90</a> 
<a name="line91">  91</a> <font color="#444444">/* Convection vector, first component */</font>
<a name="line92">  92</a> <strong>double</strong> <font color="#2040a0">B1</font><font color="4444FF">(</font><strong>double</strong> <font color="#2040a0">x</font>, <strong>double</strong> <font color="#2040a0">y</font><font color="4444FF">)</font>
<a name="line93">  93</a> <font color="4444FF"><strong>{</strong></font>
<a name="line94">  94</a>    <strong>switch</strong> <font color="4444FF">(</font><font color="#2040a0">optionB</font><font color="4444FF">)</font>
<a name="line95">  95</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line96">  96</a>       <strong>case</strong> <font color="#FF0000">0</font><font color="4444FF">:</font>
<a name="line97">  97</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line98">  98</a>       <strong>case</strong> <font color="#FF0000">1</font><font color="4444FF">:</font>
<a name="line99">  99</a>          <strong>return</strong> <font color="4444FF">-</font><font color="#FF0000">0.1</font><font color="4444FF">;</font>
<a name="line100"> 100</a>       <strong>case</strong> <font color="#FF0000">2</font><font color="4444FF">:</font>
<a name="line101"> 101</a>          <strong>return</strong> <font color="#FF0000">0.25</font><font color="4444FF">;</font>
<a name="line102"> 102</a>       <strong>case</strong> <font color="#FF0000">3</font><font color="4444FF">:</font>
<a name="line103"> 103</a>          <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line104"> 104</a>       <strong>default</strong><font color="4444FF">:</font>
<a name="line105"> 105</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line106"> 106</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line107"> 107</a> <font color="4444FF"><strong>}</strong></font>
<a name="line108"> 108</a> 
<a name="line109"> 109</a> <font color="#444444">/* Convection vector, second component */</font>
<a name="line110"> 110</a> <strong>double</strong> <font color="#2040a0">B2</font><font color="4444FF">(</font><strong>double</strong> <font color="#2040a0">x</font>, <strong>double</strong> <font color="#2040a0">y</font><font color="4444FF">)</font>
<a name="line111"> 111</a> <font color="4444FF"><strong>{</strong></font>
<a name="line112"> 112</a>    <strong>switch</strong> <font color="4444FF">(</font><font color="#2040a0">optionB</font><font color="4444FF">)</font>
<a name="line113"> 113</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line114"> 114</a>       <strong>case</strong> <font color="#FF0000">0</font><font color="4444FF">:</font>
<a name="line115"> 115</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line116"> 116</a>       <strong>case</strong> <font color="#FF0000">1</font><font color="4444FF">:</font>
<a name="line117"> 117</a>          <strong>return</strong> <font color="#FF0000">0.1</font><font color="4444FF">;</font>
<a name="line118"> 118</a>       <strong>case</strong> <font color="#FF0000">2</font><font color="4444FF">:</font>
<a name="line119"> 119</a>          <strong>return</strong> <font color="4444FF">-</font><font color="#FF0000">0.25</font><font color="4444FF">;</font>
<a name="line120"> 120</a>       <strong>case</strong> <font color="#FF0000">3</font><font color="4444FF">:</font>
<a name="line121"> 121</a>          <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line122"> 122</a>       <strong>default</strong><font color="4444FF">:</font>
<a name="line123"> 123</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line124"> 124</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line125"> 125</a> <font color="4444FF"><strong>}</strong></font>
<a name="line126"> 126</a> 
<a name="line127"> 127</a> <font color="#444444">/* Reaction coefficient */</font>
<a name="line128"> 128</a> <strong>double</strong> <font color="#2040a0">C</font><font color="4444FF">(</font><strong>double</strong> <font color="#2040a0">x</font>, <strong>double</strong> <font color="#2040a0">y</font><font color="4444FF">)</font>
<a name="line129"> 129</a> <font color="4444FF"><strong>{</strong></font>
<a name="line130"> 130</a>    <strong>switch</strong> <font color="4444FF">(</font><font color="#2040a0">optionC</font><font color="4444FF">)</font>
<a name="line131"> 131</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line132"> 132</a>       <strong>case</strong> <font color="#FF0000">0</font><font color="4444FF">:</font>
<a name="line133"> 133</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line134"> 134</a>       <strong>case</strong> <font color="#FF0000">1</font><font color="4444FF">:</font>
<a name="line135"> 135</a>          <strong>return</strong> <font color="#FF0000">10.0</font><font color="4444FF">;</font>
<a name="line136"> 136</a>       <strong>case</strong> <font color="#FF0000">2</font><font color="4444FF">:</font>
<a name="line137"> 137</a>          <strong>return</strong> <font color="#FF0000">100.0</font><font color="4444FF">;</font>
<a name="line138"> 138</a>       <strong>default</strong><font color="4444FF">:</font>
<a name="line139"> 139</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line140"> 140</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line141"> 141</a> <font color="4444FF"><strong>}</strong></font>
<a name="line142"> 142</a> 
<a name="line143"> 143</a> <font color="#444444">/* Boundary condition */</font>
<a name="line144"> 144</a> <strong>double</strong> <font color="#2040a0">U0</font><font color="4444FF">(</font><strong>double</strong> <font color="#2040a0">x</font>, <strong>double</strong> <font color="#2040a0">y</font><font color="4444FF">)</font>
<a name="line145"> 145</a> <font color="4444FF"><strong>{</strong></font>
<a name="line146"> 146</a>    <strong>switch</strong> <font color="4444FF">(</font><font color="#2040a0">optionU0</font><font color="4444FF">)</font>
<a name="line147"> 147</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line148"> 148</a>       <strong>case</strong> <font color="#FF0000">0</font><font color="4444FF">:</font>
<a name="line149"> 149</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line150"> 150</a>       <strong>case</strong> <font color="#FF0000">1</font><font color="4444FF">:</font>
<a name="line151"> 151</a>          <strong>return</strong> <font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">+</font><font color="#2040a0">y</font><font color="4444FF">)</font>/<font color="#FF0000">100</font><font color="4444FF">;</font>
<a name="line152"> 152</a>       <strong>case</strong> <font color="#FF0000">2</font><font color="4444FF">:</font>
<a name="line153"> 153</a>          <strong>return</strong> <font color="4444FF">(</font><font color="#2040a0">sin</font><font color="4444FF">(</font><font color="#FF0000">5</font><font color="4444FF">*</font><font color="#2040a0">PI</font><font color="4444FF">*</font><font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="#2040a0">sin</font><font color="4444FF">(</font><font color="#FF0000">5</font><font color="4444FF">*</font><font color="#2040a0">PI</font><font color="4444FF">*</font><font color="#2040a0">y</font><font color="4444FF">)</font><font color="4444FF">)</font>/<font color="#FF0000">1000</font><font color="4444FF">;</font>
<a name="line154"> 154</a>       <strong>default</strong><font color="4444FF">:</font>
<a name="line155"> 155</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line156"> 156</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line157"> 157</a> <font color="4444FF"><strong>}</strong></font>
<a name="line158"> 158</a> 
<a name="line159"> 159</a> <font color="#444444">/* Right-hand side */</font>
<a name="line160"> 160</a> <strong>double</strong> <font color="#2040a0">F</font><font color="4444FF">(</font><strong>double</strong> <font color="#2040a0">x</font>, <strong>double</strong> <font color="#2040a0">y</font><font color="4444FF">)</font>
<a name="line161"> 161</a> <font color="4444FF"><strong>{</strong></font>
<a name="line162"> 162</a>    <strong>switch</strong> <font color="4444FF">(</font><font color="#2040a0">optionF</font><font color="4444FF">)</font>
<a name="line163"> 163</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line164"> 164</a>       <strong>case</strong> <font color="#FF0000">0</font><font color="4444FF">:</font>
<a name="line165"> 165</a>          <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line166"> 166</a>       <strong>case</strong> <font color="#FF0000">1</font><font color="4444FF">:</font>
<a name="line167"> 167</a>          <strong>return</strong> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line168"> 168</a>       <strong>case</strong> <font color="#FF0000">2</font><font color="4444FF">:</font>
<a name="line169"> 169</a>          <strong>return</strong> <font color="#FF0000">2</font><font color="4444FF">*</font><font color="#2040a0">PI</font><font color="4444FF">*</font><font color="#2040a0">PI</font><font color="4444FF">*</font><font color="#2040a0">sin</font><font color="4444FF">(</font><font color="#2040a0">PI</font><font color="4444FF">*</font><font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">*</font><font color="#2040a0">sin</font><font color="4444FF">(</font><font color="#2040a0">PI</font><font color="4444FF">*</font><font color="#2040a0">y</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line170"> 170</a>       <strong>case</strong> <font color="#FF0000">3</font><font color="4444FF">:</font>
<a name="line171"> 171</a>          <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">fabs</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0.25</font><font color="4444FF">)</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="4444FF">(</font><font color="#2040a0">fabs</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0.25</font><font color="4444FF">)</font><font color="4444FF">)</font>
<a name="line172"> 172</a>             <strong>return</strong> <font color="4444FF">-</font><font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line173"> 173</a>          <strong>else</strong>
<a name="line174"> 174</a>             <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line175"> 175</a>       <strong>case</strong> <font color="#FF0000">4</font><font color="4444FF">:</font>
<a name="line176"> 176</a>          <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">*</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">*</font><font color="4444FF">(</font><font color="#2040a0">y</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0.0625</font><font color="4444FF">)</font>
<a name="line177"> 177</a>             <strong>return</strong> <font color="4444FF">-</font><font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line178"> 178</a>          <strong>else</strong>
<a name="line179"> 179</a>             <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line180"> 180</a>       <strong>default</strong><font color="4444FF">:</font>
<a name="line181"> 181</a>          <strong>return</strong> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line182"> 182</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line183"> 183</a> <font color="4444FF"><strong>}</strong></font>
<a name="line184"> 184</a> 
<a name="line185"> 185</a> <strong>int</strong> <font color="#2040a0">main</font> <font color="4444FF">(</font><strong>int</strong> <font color="#2040a0">argc</font>, <strong>char</strong> <font color="4444FF">*</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="4444FF">]</font><font color="4444FF">)</font>
<a name="line186"> 186</a> <font color="4444FF"><strong>{</strong></font>
<a name="line187"> 187</a>    <strong>int</strong> <font color="#2040a0">i</font>, <font color="#2040a0">j</font>, <font color="#2040a0">k</font><font color="4444FF">;</font>
<a name="line188"> 188</a> 
<a name="line189"> 189</a>    <strong>int</strong> <font color="#2040a0">myid</font>, <font color="#2040a0">num_procs</font><font color="4444FF">;</font>
<a name="line190"> 190</a> 
<a name="line191"> 191</a>    <strong>int</strong> <font color="#2040a0">n</font>, <font color="#2040a0">N</font>, <font color="#2040a0">pi</font>, <font color="#2040a0">pj</font><font color="4444FF">;</font>
<a name="line192"> 192</a>    <strong>double</strong> <font color="#2040a0">h</font>, <font color="#2040a0">h2</font><font color="4444FF">;</font>
<a name="line193"> 193</a>    <strong>int</strong> <font color="#2040a0">ilower</font><font color="4444FF">[</font><font color="#FF0000">2</font><font color="4444FF">]</font>, <font color="#2040a0">iupper</font><font color="4444FF">[</font><font color="#FF0000">2</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line194"> 194</a> 
<a name="line195"> 195</a>    <strong>int</strong> <font color="#2040a0">solver_id</font><font color="4444FF">;</font>
<a name="line196"> 196</a>    <strong>int</strong> <font color="#2040a0">n_pre</font>, <font color="#2040a0">n_post</font><font color="4444FF">;</font>
<a name="line197"> 197</a>    <strong>int</strong> <font color="#2040a0">rap</font>, <font color="#2040a0">relax</font>, <font color="#2040a0">skip</font>, <font color="#2040a0">sym</font><font color="4444FF">;</font>
<a name="line198"> 198</a>    <strong>int</strong> <font color="#2040a0">time_index</font><font color="4444FF">;</font>
<a name="line199"> 199</a> 
<a name="line200"> 200</a>    <strong>int</strong> <font color="#2040a0">num_iterations</font><font color="4444FF">;</font>
<a name="line201"> 201</a>    <strong>double</strong> <font color="#2040a0">final_res_norm</font><font color="4444FF">;</font>
<a name="line202"> 202</a> 
<a name="line203"> 203</a>    <strong>int</strong> <font color="#2040a0">vis</font><font color="4444FF">;</font>
<a name="line204"> 204</a> 
<a name="line205"> 205</a>    <font color="#2040a0">HYPRE_StructGrid</font>     <font color="#2040a0">grid</font><font color="4444FF">;</font>
<a name="line206"> 206</a>    <font color="#2040a0">HYPRE_StructStencil</font>  <font color="#2040a0">stencil</font><font color="4444FF">;</font>
<a name="line207"> 207</a>    <font color="#2040a0">HYPRE_StructMatrix</font>   <font color="#2040a0">A</font><font color="4444FF">;</font>
<a name="line208"> 208</a>    <font color="#2040a0">HYPRE_StructVector</font>   <font color="#2040a0">b</font><font color="4444FF">;</font>
<a name="line209"> 209</a>    <font color="#2040a0">HYPRE_StructVector</font>   <font color="#2040a0">x</font><font color="4444FF">;</font>
<a name="line210"> 210</a>    <font color="#2040a0">HYPRE_StructSolver</font>   <font color="#2040a0">solver</font><font color="4444FF">;</font>
<a name="line211"> 211</a>    <font color="#2040a0">HYPRE_StructSolver</font>   <font color="#2040a0">precond</font><font color="4444FF">;</font>
<a name="line212"> 212</a> 
<a name="line213"> 213</a>    <font color="#444444">/* Initialize MPI */</font>
<a name="line214"> 214</a>    <font color="#2040a0">MPI_Init</font><font color="4444FF">(</font><font color="4444FF">&amp;</font><font color="#2040a0">argc</font>, <font color="4444FF">&amp;</font><font color="#2040a0">argv</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line215"> 215</a>    <font color="#2040a0">MPI_Comm_rank</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">myid</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line216"> 216</a>    <font color="#2040a0">MPI_Comm_size</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">num_procs</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line217"> 217</a> 
<a name="line218"> 218</a>    <font color="#444444">/* Set default parameters */</font>
<a name="line219"> 219</a>    <font color="#2040a0">n</font>         <font color="4444FF">=</font> <font color="#FF0000">33</font><font color="4444FF">;</font>
<a name="line220"> 220</a>    <font color="#2040a0">optionK</font>   <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line221"> 221</a>    <font color="#2040a0">optionB</font>   <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line222"> 222</a>    <font color="#2040a0">optionC</font>   <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line223"> 223</a>    <font color="#2040a0">optionU0</font>  <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line224"> 224</a>    <font color="#2040a0">optionF</font>   <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line225"> 225</a>    <font color="#2040a0">solver_id</font> <font color="4444FF">=</font> <font color="#FF0000">10</font><font color="4444FF">;</font>
<a name="line226"> 226</a>    <font color="#2040a0">n_pre</font>     <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line227"> 227</a>    <font color="#2040a0">n_post</font>    <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line228"> 228</a>    <font color="#2040a0">rap</font>       <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line229"> 229</a>    <font color="#2040a0">relax</font>     <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line230"> 230</a>    <font color="#2040a0">skip</font>      <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line231"> 231</a>    <font color="#2040a0">sym</font>       <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line232"> 232</a> 
<a name="line233"> 233</a>    <font color="#2040a0">vis</font>       <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line234"> 234</a> 
<a name="line235"> 235</a>    <font color="#444444">/* Parse command line */</font>
<a name="line236"> 236</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line237"> 237</a>       <strong>int</strong> <font color="#2040a0">arg_index</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line238"> 238</a>       <strong>int</strong> <font color="#2040a0">print_usage</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line239"> 239</a> 
<a name="line240"> 240</a>       <strong>while</strong> <font color="4444FF">(</font><font color="#2040a0">arg_index</font> <font color="4444FF">&lt;</font> <font color="#2040a0">argc</font><font color="4444FF">)</font>
<a name="line241"> 241</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line242"> 242</a>          <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-n&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line243"> 243</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line244"> 244</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line245"> 245</a>             <font color="#2040a0">n</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line246"> 246</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line247"> 247</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-K&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line248"> 248</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line249"> 249</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line250"> 250</a>             <font color="#2040a0">optionK</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line251"> 251</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line252"> 252</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-B&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line253"> 253</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line254"> 254</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line255"> 255</a>             <font color="#2040a0">optionB</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line256"> 256</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line257"> 257</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-C&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line258"> 258</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line259"> 259</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line260"> 260</a>             <font color="#2040a0">optionC</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line261"> 261</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line262"> 262</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-U0&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line263"> 263</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line264"> 264</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line265"> 265</a>             <font color="#2040a0">optionU0</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line266"> 266</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line267"> 267</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-F&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line268"> 268</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line269"> 269</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line270"> 270</a>             <font color="#2040a0">optionF</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line271"> 271</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line272"> 272</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-solver&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line273"> 273</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line274"> 274</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line275"> 275</a>             <font color="#2040a0">solver_id</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line276"> 276</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line277"> 277</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-v&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line278"> 278</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line279"> 279</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line280"> 280</a>             <font color="#2040a0">n_pre</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line281"> 281</a>             <font color="#2040a0">n_post</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line282"> 282</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line283"> 283</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-rap&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line284"> 284</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line285"> 285</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line286"> 286</a>             <font color="#2040a0">rap</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line287"> 287</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line288"> 288</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-relax&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line289"> 289</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line290"> 290</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line291"> 291</a>             <font color="#2040a0">relax</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line292"> 292</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line293"> 293</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-skip&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line294"> 294</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line295"> 295</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line296"> 296</a>             <font color="#2040a0">skip</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line297"> 297</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line298"> 298</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-sym&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line299"> 299</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line300"> 300</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line301"> 301</a>             <font color="#2040a0">sym</font> <font color="4444FF">=</font> <font color="#2040a0">atoi</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line302"> 302</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line303"> 303</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-vis&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line304"> 304</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line305"> 305</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line306"> 306</a>             <font color="#2040a0">vis</font> <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line307"> 307</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line308"> 308</a>          <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font> <font color="#2040a0">strcmp</font><font color="4444FF">(</font><font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#2040a0">arg_index</font><font color="4444FF">]</font>, <font color="#008000">&quot;-help&quot;</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font> <font color="4444FF">)</font>
<a name="line309"> 309</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line310"> 310</a>             <font color="#2040a0">print_usage</font> <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line311"> 311</a>             <strong>break</strong><font color="4444FF">;</font>
<a name="line312"> 312</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line313"> 313</a>          <strong>else</strong>
<a name="line314"> 314</a>          <font color="4444FF"><strong>{</strong></font>
<a name="line315"> 315</a>             <font color="#2040a0">arg_index</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">;</font>
<a name="line316"> 316</a>          <font color="4444FF"><strong>}</strong></font>
<a name="line317"> 317</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line318"> 318</a> 
<a name="line319"> 319</a>       <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">print_usage</font><font color="4444FF">)</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="4444FF">(</font><font color="#2040a0">myid</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">)</font>
<a name="line320"> 320</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line321"> 321</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line322"> 322</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;Usage: %s [&lt;options&gt;]<font color="#77dd77">\n</font>&quot;</font>, <font color="#2040a0">argv</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line323"> 323</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line324"> 324</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -n  &lt;n&gt;             : problem size per processor (default: 8)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line325"> 325</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -K  &lt;K&gt;             : choice for the diffusion coefficient (default: 1)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line326"> 326</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -B  &lt;B&gt;             : choice for the convection vector (default: 0)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line327"> 327</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -C  &lt;C&gt;             : choice for the reaction coefficient (default: 0)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line328"> 328</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -U0 &lt;U0&gt;            : choice for the boundary condition (default: 0)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line329"> 329</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -F  &lt;F&gt;             : choice for the right-hand side (default: 1) <font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line330"> 330</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -solver &lt;ID&gt;        : solver ID<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line331"> 331</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        0  - SMG <font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line332"> 332</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        1  - PFMG<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line333"> 333</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        10 - CG with SMG precond (default)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line334"> 334</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        11 - CG with PFMG precond<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line335"> 335</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        17 - CG with 2-step Jacobi<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line336"> 336</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        18 - CG with diagonal scaling<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line337"> 337</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        19 - CG<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line338"> 338</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        30 - GMRES with SMG precond<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line339"> 339</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        31 - GMRES with PFMG precond<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line340"> 340</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        37 - GMRES with 2-step Jacobi<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line341"> 341</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        38 - GMRES with diagonal scaling<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line342"> 342</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        39 - GMRES<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line343"> 343</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -v &lt;n_pre&gt; &lt;n_post&gt; : number of pre and post relaxations<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line344"> 344</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -rap &lt;r&gt;            : coarse grid operator type<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line345"> 345</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        0 - Galerkin (default)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line346"> 346</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        1 - non-Galerkin ParFlow operators<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line347"> 347</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        2 - Galerkin, general operators<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line348"> 348</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -relax &lt;r&gt;          : relaxation type<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line349"> 349</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        0 - Jacobi<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line350"> 350</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        1 - Weighted Jacobi (default)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line351"> 351</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        2 - R/B Gauss-Seidel<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line352"> 352</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;                        3 - R/B Gauss-Seidel (nonsymmetric)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line353"> 353</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -skip &lt;s&gt;           : skip levels in PFMG (0 or 1)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line354"> 354</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -sym &lt;s&gt;            : symmetric storage (1) or not (0)<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line355"> 355</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;  -vis                : save the solution for GLVis visualization<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line356"> 356</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line357"> 357</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line358"> 358</a> 
<a name="line359"> 359</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">print_usage</font><font color="4444FF">)</font>
<a name="line360"> 360</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line361"> 361</a>          <font color="#2040a0">MPI_Finalize</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line362"> 362</a>          <strong>return</strong> <font color="4444FF">(</font><font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line363"> 363</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line364"> 364</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line365"> 365</a> 
<a name="line366"> 366</a>    <font color="#444444">/* Convection produces non-symmetric matrices */</font>
<a name="line367"> 367</a>    <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">optionB</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="#2040a0">sym</font><font color="4444FF">)</font>
<a name="line368"> 368</a>       <font color="#2040a0">optionB</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line369"> 369</a> 
<a name="line370"> 370</a>    <font color="#444444">/* Figure out the processor grid (N x N).  The local
<a name="line371"> 371</a>       problem size is indicated by n (n x n). pi and pj
<a name="line372"> 372</a>       indicate position in the processor grid. */</font>
<a name="line373"> 373</a>    <font color="#2040a0">N</font>  <font color="4444FF">=</font> <font color="#2040a0">sqrt</font><font color="4444FF">(</font><font color="#2040a0">num_procs</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line374"> 374</a>    <font color="#2040a0">h</font>  <font color="4444FF">=</font> <font color="#FF0000">1.0</font> / <font color="4444FF">(</font><font color="#2040a0">N</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line375"> 375</a>    <font color="#2040a0">h2</font> <font color="4444FF">=</font> <font color="#2040a0">h</font><font color="4444FF">*</font><font color="#2040a0">h</font><font color="4444FF">;</font>
<a name="line376"> 376</a>    <font color="#2040a0">pj</font> <font color="4444FF">=</font> <font color="#2040a0">myid</font> / <font color="#2040a0">N</font><font color="4444FF">;</font>
<a name="line377"> 377</a>    <font color="#2040a0">pi</font> <font color="4444FF">=</font> <font color="#2040a0">myid</font> <font color="4444FF">-</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">N</font><font color="4444FF">;</font>
<a name="line378"> 378</a> 
<a name="line379"> 379</a>    <font color="#444444">/* Define the nodes owned by the current processor (each processor's
<a name="line380"> 380</a>       piece of the global grid) */</font>
<a name="line381"> 381</a>    <font color="#2040a0">ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line382"> 382</a>    <font color="#2040a0">ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line383"> 383</a>    <font color="#2040a0">iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line384"> 384</a>    <font color="#2040a0">iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line385"> 385</a> 
<a name="line386"> 386</a>    <font color="#444444">/* 1. Set up a grid */</font>
<a name="line387"> 387</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line388"> 388</a>       <font color="#444444">/* Create an empty 2D grid object */</font>
<a name="line389"> 389</a>       <font color="#2040a0">HYPRE_StructGridCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#FF0000">2</font>, <font color="4444FF">&amp;</font><font color="#2040a0">grid</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line390"> 390</a> 
<a name="line391"> 391</a>       <font color="#444444">/* Add a new box to the grid */</font>
<a name="line392"> 392</a>       <font color="#2040a0">HYPRE_StructGridSetExtents</font><font color="4444FF">(</font><font color="#2040a0">grid</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line393"> 393</a> 
<a name="line394"> 394</a>       <font color="#444444">/* This is a collective call finalizing the grid assembly.
<a name="line395"> 395</a>          The grid is now ``ready to be used'' */</font>
<a name="line396"> 396</a>       <font color="#2040a0">HYPRE_StructGridAssemble</font><font color="4444FF">(</font><font color="#2040a0">grid</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line397"> 397</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line398"> 398</a> 
<a name="line399"> 399</a>    <font color="#444444">/* 2. Define the discretization stencil */</font>
<a name="line400"> 400</a>    <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line401"> 401</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line402"> 402</a>       <font color="#444444">/* Define the geometry of the stencil */</font>
<a name="line403"> 403</a>       <strong>int</strong> <font color="#2040a0">offsets</font><font color="4444FF">[</font><font color="#FF0000">5</font><font color="4444FF">]</font><font color="4444FF">[</font><font color="#FF0000">2</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF"><strong>{</strong></font><font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>,<font color="#FF0000">0</font><font color="4444FF"><strong>}</strong></font>, <font color="4444FF"><strong>{</strong></font><font color="4444FF">-</font><font color="#FF0000">1</font>,<font color="#FF0000">0</font><font color="4444FF"><strong>}</strong></font>, <font color="4444FF"><strong>{</strong></font><font color="#FF0000">1</font>,<font color="#FF0000">0</font><font color="4444FF"><strong>}</strong></font>, <font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>,<font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF"><strong>}</strong></font>, <font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>,<font color="#FF0000">1</font><font color="4444FF"><strong>}</strong></font><font color="4444FF"><strong>}</strong></font><font color="4444FF">;</font>
<a name="line404"> 404</a> 
<a name="line405"> 405</a>       <font color="#444444">/* Create an empty 2D, 5-pt stencil object */</font>
<a name="line406"> 406</a>       <font color="#2040a0">HYPRE_StructStencilCreate</font><font color="4444FF">(</font><font color="#FF0000">2</font>, <font color="#FF0000">5</font>, <font color="4444FF">&amp;</font><font color="#2040a0">stencil</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line407"> 407</a> 
<a name="line408"> 408</a>       <font color="#444444">/* Assign stencil entries */</font>
<a name="line409"> 409</a>       <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#FF0000">5</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line410"> 410</a>          <font color="#2040a0">HYPRE_StructStencilSetElement</font><font color="4444FF">(</font><font color="#2040a0">stencil</font>, <font color="#2040a0">i</font>, <font color="#2040a0">offsets</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line411"> 411</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line412"> 412</a>    <strong>else</strong> <font color="#444444">/* Symmetric storage */</font>
<a name="line413"> 413</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line414"> 414</a>       <font color="#444444">/* Define the geometry of the stencil */</font>
<a name="line415"> 415</a>       <strong>int</strong> <font color="#2040a0">offsets</font><font color="4444FF">[</font><font color="#FF0000">3</font><font color="4444FF">]</font><font color="4444FF">[</font><font color="#FF0000">2</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF"><strong>{</strong></font><font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>,<font color="#FF0000">0</font><font color="4444FF"><strong>}</strong></font>, <font color="4444FF"><strong>{</strong></font><font color="#FF0000">1</font>,<font color="#FF0000">0</font><font color="4444FF"><strong>}</strong></font>, <font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>,<font color="#FF0000">1</font><font color="4444FF"><strong>}</strong></font><font color="4444FF"><strong>}</strong></font><font color="4444FF">;</font>
<a name="line416"> 416</a> 
<a name="line417"> 417</a>       <font color="#444444">/* Create an empty 2D, 3-pt stencil object */</font>
<a name="line418"> 418</a>       <font color="#2040a0">HYPRE_StructStencilCreate</font><font color="4444FF">(</font><font color="#FF0000">2</font>, <font color="#FF0000">3</font>, <font color="4444FF">&amp;</font><font color="#2040a0">stencil</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line419"> 419</a> 
<a name="line420"> 420</a>       <font color="#444444">/* Assign stencil entries */</font>
<a name="line421"> 421</a>       <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#FF0000">3</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line422"> 422</a>          <font color="#2040a0">HYPRE_StructStencilSetElement</font><font color="4444FF">(</font><font color="#2040a0">stencil</font>, <font color="#2040a0">i</font>, <font color="#2040a0">offsets</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line423"> 423</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line424"> 424</a> 
<a name="line425"> 425</a>    <font color="#444444">/* 3. Set up Struct Vectors for b and x */</font>
<a name="line426"> 426</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line427"> 427</a>       <strong>double</strong> <font color="4444FF">*</font><font color="#2040a0">values</font><font color="4444FF">;</font>
<a name="line428"> 428</a> 
<a name="line429"> 429</a>       <font color="#444444">/* Create an empty vector object */</font>
<a name="line430"> 430</a>       <font color="#2040a0">HYPRE_StructVectorCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">grid</font>, <font color="4444FF">&amp;</font><font color="#2040a0">b</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line431"> 431</a>       <font color="#2040a0">HYPRE_StructVectorCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">grid</font>, <font color="4444FF">&amp;</font><font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line432"> 432</a> 
<a name="line433"> 433</a>       <font color="#444444">/* Indicate that the vector coefficients are ready to be set */</font>
<a name="line434"> 434</a>       <font color="#2040a0">HYPRE_StructVectorInitialize</font><font color="4444FF">(</font><font color="#2040a0">b</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line435"> 435</a>       <font color="#2040a0">HYPRE_StructVectorInitialize</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line436"> 436</a> 
<a name="line437"> 437</a>       <font color="#2040a0">values</font> <font color="4444FF">=</font> <font color="#2040a0">calloc</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">n</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">)</font>, <strong>sizeof</strong><font color="4444FF">(</font><strong>double</strong><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line438"> 438</a> 
<a name="line439"> 439</a>       <font color="#444444">/* Set the values of b in left-to-right, bottom-to-top order */</font>
<a name="line440"> 440</a>       <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">k</font> <font color="4444FF">=</font> <font color="#FF0000">0</font>, <font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line441"> 441</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font>, <font color="#2040a0">k</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line442"> 442</a>             <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">h2</font> <font color="4444FF">*</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">F</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line443"> 443</a>       <font color="#2040a0">HYPRE_StructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line444"> 444</a> 
<a name="line445"> 445</a>       <font color="#444444">/* Set x = 0 */</font>
<a name="line446"> 446</a>       <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="4444FF">(</font><font color="#2040a0">n</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">)</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line447"> 447</a>          <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line448"> 448</a>       <font color="#2040a0">HYPRE_StructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line449"> 449</a> 
<a name="line450"> 450</a>       <font color="#2040a0">free</font><font color="4444FF">(</font><font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line451"> 451</a> 
<a name="line452"> 452</a>       <font color="#444444">/* Assembling is postponed since the vectors will be further modified */</font>
<a name="line453"> 453</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line454"> 454</a> 
<a name="line455"> 455</a>    <font color="#444444">/* 4. Set up a Struct Matrix */</font>
<a name="line456"> 456</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line457"> 457</a>       <font color="#444444">/* Create an empty matrix object */</font>
<a name="line458"> 458</a>       <font color="#2040a0">HYPRE_StructMatrixCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="#2040a0">grid</font>, <font color="#2040a0">stencil</font>, <font color="4444FF">&amp;</font><font color="#2040a0">A</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line459"> 459</a> 
<a name="line460"> 460</a>       <font color="#444444">/* Use symmetric storage? */</font>
<a name="line461"> 461</a>       <font color="#2040a0">HYPRE_StructMatrixSetSymmetric</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">sym</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line462"> 462</a> 
<a name="line463"> 463</a>       <font color="#444444">/* Indicate that the matrix coefficients are ready to be set */</font>
<a name="line464"> 464</a>       <font color="#2040a0">HYPRE_StructMatrixInitialize</font><font color="4444FF">(</font><font color="#2040a0">A</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line465"> 465</a> 
<a name="line466"> 466</a>       <font color="#444444">/* Set the stencil values in the interior. Here we set the values
<a name="line467"> 467</a>          at every node. We will modify the boundary nodes later. */</font>
<a name="line468"> 468</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line469"> 469</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line470"> 470</a>          <strong>int</strong> <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">5</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>, <font color="#FF0000">1</font>, <font color="#FF0000">2</font>, <font color="#FF0000">3</font>, <font color="#FF0000">4</font><font color="4444FF"><strong>}</strong></font><font color="4444FF">;</font> <font color="#444444">/* labels correspond
<a name="line471"> 471</a>                                                       to the offsets */</font>
<a name="line472"> 472</a>          <strong>double</strong> <font color="4444FF">*</font><font color="#2040a0">values</font><font color="4444FF">;</font>
<a name="line473"> 473</a> 
<a name="line474"> 474</a>          <font color="#2040a0">values</font> <font color="4444FF">=</font> <font color="#2040a0">calloc</font><font color="4444FF">(</font><font color="#FF0000">5</font><font color="4444FF">*</font><font color="4444FF">(</font><font color="#2040a0">n</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">)</font>, <strong>sizeof</strong><font color="4444FF">(</font><strong>double</strong><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line475"> 475</a> 
<a name="line476"> 476</a>          <font color="#444444">/* The order is left-to-right, bottom-to-top */</font>
<a name="line477"> 477</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">k</font> <font color="4444FF">=</font> <font color="#FF0000">0</font>, <font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line478"> 478</a>             <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font>, <font color="#2040a0">k</font><font color="4444FF">+</font><font color="4444FF">=</font><font color="#FF0000">5</font><font color="4444FF">)</font>
<a name="line479"> 479</a>             <font color="4444FF"><strong>{</strong></font>
<a name="line480"> 480</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font><font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B1</font>,<font color="#2040a0">i</font><font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line481"> 481</a> 
<a name="line482"> 482</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="#FF0000">2</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font><font color="4444FF">+</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B1</font>,<font color="#2040a0">i</font><font color="4444FF">+</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line483"> 483</a> 
<a name="line484"> 484</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="#FF0000">3</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B2</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line485"> 485</a> 
<a name="line486"> 486</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="#FF0000">4</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">+</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B2</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">+</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line487"> 487</a> 
<a name="line488"> 488</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">h2</font> <font color="4444FF">*</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">C</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">)</font>
<a name="line489"> 489</a>                   <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font> ,<font color="#2040a0">i</font><font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font> ,<font color="#2040a0">i</font><font color="4444FF">+</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font>
<a name="line490"> 490</a>                   <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font> ,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font> ,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">+</font><font color="#FF0000">0.5</font><font color="4444FF">)</font>
<a name="line491"> 491</a>                   <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B1</font>,<font color="#2040a0">i</font><font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B1</font>,<font color="#2040a0">i</font><font color="4444FF">+</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font>
<a name="line492"> 492</a>                   <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B2</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">B2</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">+</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line493"> 493</a>             <font color="4444FF"><strong>}</strong></font>
<a name="line494"> 494</a> 
<a name="line495"> 495</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>, <font color="#FF0000">5</font>,
<a name="line496"> 496</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line497"> 497</a> 
<a name="line498"> 498</a>          <font color="#2040a0">free</font><font color="4444FF">(</font><font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line499"> 499</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line500"> 500</a>       <strong>else</strong> <font color="#444444">/* Symmetric storage */</font>
<a name="line501"> 501</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line502"> 502</a>          <strong>int</strong> <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">3</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>, <font color="#FF0000">1</font>, <font color="#FF0000">2</font><font color="4444FF"><strong>}</strong></font><font color="4444FF">;</font>
<a name="line503"> 503</a>          <strong>double</strong> <font color="4444FF">*</font><font color="#2040a0">values</font><font color="4444FF">;</font>
<a name="line504"> 504</a> 
<a name="line505"> 505</a>          <font color="#2040a0">values</font> <font color="4444FF">=</font> <font color="#2040a0">calloc</font><font color="4444FF">(</font><font color="#FF0000">3</font><font color="4444FF">*</font><font color="4444FF">(</font><font color="#2040a0">n</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">)</font>, <strong>sizeof</strong><font color="4444FF">(</font><strong>double</strong><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line506"> 506</a> 
<a name="line507"> 507</a>          <font color="#444444">/* The order is left-to-right, bottom-to-top */</font>
<a name="line508"> 508</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">k</font> <font color="4444FF">=</font> <font color="#FF0000">0</font>, <font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line509"> 509</a>             <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font>, <font color="#2040a0">k</font><font color="4444FF">+</font><font color="4444FF">=</font><font color="#FF0000">3</font><font color="4444FF">)</font>
<a name="line510"> 510</a>             <font color="4444FF"><strong>{</strong></font>
<a name="line511"> 511</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font><font color="4444FF">+</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line512"> 512</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="#FF0000">2</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF">-</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">+</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line513"> 513</a>                <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">h2</font> <font color="4444FF">*</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">C</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">)</font>
<a name="line514"> 514</a>                   <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font><font color="4444FF">+</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">+</font><font color="#FF0000">0.5</font><font color="4444FF">)</font>
<a name="line515"> 515</a>                   <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font><font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">Eval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="#2040a0">j</font><font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line516"> 516</a>             <font color="4444FF"><strong>}</strong></font>
<a name="line517"> 517</a> 
<a name="line518"> 518</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>, <font color="#FF0000">3</font>,
<a name="line519"> 519</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line520"> 520</a> 
<a name="line521"> 521</a>          <font color="#2040a0">free</font><font color="4444FF">(</font><font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line522"> 522</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line523"> 523</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line524"> 524</a> 
<a name="line525"> 525</a>    <font color="#444444">/* 5. Set the boundary conditions, while eliminating the coefficients
<a name="line526"> 526</a>          reaching ouside of the domain boundary. We must modify the matrix
<a name="line527"> 527</a>          stencil and the corresponding rhs entries. */</font>
<a name="line528"> 528</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line529"> 529</a>       <strong>int</strong> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">2</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line530"> 530</a>       <strong>int</strong> <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">2</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line531"> 531</a> 
<a name="line532"> 532</a>       <strong>int</strong> <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">5</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="4444FF"><strong>{</strong></font><font color="#FF0000">0</font>, <font color="#FF0000">1</font>, <font color="#FF0000">2</font>, <font color="#FF0000">3</font>, <font color="#FF0000">4</font><font color="4444FF"><strong>}</strong></font><font color="4444FF">;</font>
<a name="line533"> 533</a>       <strong>double</strong> <font color="4444FF">*</font><font color="#2040a0">values</font>, <font color="4444FF">*</font><font color="#2040a0">bvalues</font><font color="4444FF">;</font>
<a name="line534"> 534</a> 
<a name="line535"> 535</a>       <strong>int</strong> <font color="#2040a0">nentries</font><font color="4444FF">;</font>
<a name="line536"> 536</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line537"> 537</a>          <font color="#2040a0">nentries</font> <font color="4444FF">=</font> <font color="#FF0000">5</font><font color="4444FF">;</font>
<a name="line538"> 538</a>       <strong>else</strong>
<a name="line539"> 539</a>          <font color="#2040a0">nentries</font> <font color="4444FF">=</font> <font color="#FF0000">3</font><font color="4444FF">;</font>
<a name="line540"> 540</a> 
<a name="line541"> 541</a>       <font color="#2040a0">values</font>  <font color="4444FF">=</font> <font color="#2040a0">calloc</font><font color="4444FF">(</font><font color="#2040a0">nentries</font><font color="4444FF">*</font><font color="#2040a0">n</font>, <strong>sizeof</strong><font color="4444FF">(</font><strong>double</strong><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line542"> 542</a>       <font color="#2040a0">bvalues</font> <font color="4444FF">=</font> <font color="#2040a0">calloc</font><font color="4444FF">(</font><font color="#2040a0">n</font>, <strong>sizeof</strong><font color="4444FF">(</font><strong>double</strong><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line543"> 543</a> 
<a name="line544"> 544</a>       <font color="#444444">/* The stencil at the boundary nodes is 1-0-0-0-0. Because
<a name="line545"> 545</a>          we have I x_b = u_0; */</font>
<a name="line546"> 546</a>       <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">nentries</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">+</font><font color="4444FF">=</font> <font color="#2040a0">nentries</font><font color="4444FF">)</font>
<a name="line547"> 547</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line548"> 548</a>          <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">1.0</font><font color="4444FF">;</font>
<a name="line549"> 549</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">nentries</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line550"> 550</a>             <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">+</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line551"> 551</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line552"> 552</a> 
<a name="line553"> 553</a>       <font color="#444444">/* Processors at y = 0 */</font>
<a name="line554"> 554</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line555"> 555</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line556"> 556</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line557"> 557</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line558"> 558</a> 
<a name="line559"> 559</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line560"> 560</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line561"> 561</a> 
<a name="line562"> 562</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line563"> 563</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">nentries</font>,
<a name="line564"> 564</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line565"> 565</a> 
<a name="line566"> 566</a>          <font color="#444444">/* Put the boundary conditions in b */</font>
<a name="line567"> 567</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line568"> 568</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#2040a0">i</font>,<font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line569"> 569</a> 
<a name="line570"> 570</a>          <font color="#2040a0">HYPRE_StructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line571"> 571</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line572"> 572</a> 
<a name="line573"> 573</a>       <font color="#444444">/* Processors at y = 1 */</font>
<a name="line574"> 574</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line575"> 575</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line576"> 576</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line577"> 577</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line578"> 578</a> 
<a name="line579"> 579</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line580"> 580</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line581"> 581</a> 
<a name="line582"> 582</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line583"> 583</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">nentries</font>,
<a name="line584"> 584</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line585"> 585</a> 
<a name="line586"> 586</a>          <font color="#444444">/* Put the boundary conditions in b */</font>
<a name="line587"> 587</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line588"> 588</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#2040a0">i</font>,<font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line589"> 589</a> 
<a name="line590"> 590</a>          <font color="#2040a0">HYPRE_StructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line591"> 591</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line592"> 592</a> 
<a name="line593"> 593</a>       <font color="#444444">/* Processors at x = 0 */</font>
<a name="line594"> 594</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line595"> 595</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line596"> 596</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line597"> 597</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line598"> 598</a> 
<a name="line599"> 599</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line600"> 600</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line601"> 601</a> 
<a name="line602"> 602</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line603"> 603</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">nentries</font>,
<a name="line604"> 604</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line605"> 605</a> 
<a name="line606"> 606</a>          <font color="#444444">/* Put the boundary conditions in b */</font>
<a name="line607"> 607</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line608"> 608</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#FF0000">0</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line609"> 609</a> 
<a name="line610"> 610</a>          <font color="#2040a0">HYPRE_StructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line611"> 611</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line612"> 612</a> 
<a name="line613"> 613</a>       <font color="#444444">/* Processors at x = 1 */</font>
<a name="line614"> 614</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line615"> 615</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line616"> 616</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line617"> 617</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line618"> 618</a> 
<a name="line619"> 619</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line620"> 620</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line621"> 621</a> 
<a name="line622"> 622</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line623"> 623</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">nentries</font>,
<a name="line624"> 624</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line625"> 625</a> 
<a name="line626"> 626</a>          <font color="#444444">/* Put the boundary conditions in b */</font>
<a name="line627"> 627</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line628"> 628</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#FF0000">0</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line629"> 629</a> 
<a name="line630"> 630</a>          <font color="#2040a0">HYPRE_StructVectorSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line631"> 631</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line632"> 632</a> 
<a name="line633"> 633</a>       <font color="#444444">/* Recall that the system we are solving is:
<a name="line634"> 634</a>          [A_ii 0; 0 I] [x_i ; x_b] = [b_i - A_ib u_0; u_0].
<a name="line635"> 635</a>          This requires removing the connections between the interior
<a name="line636"> 636</a>          and boundary nodes that we have set up when we set the
<a name="line637"> 637</a>          5pt stencil at each node. We adjust for removing
<a name="line638"> 638</a>          these connections by appropriately modifying the rhs.
<a name="line639"> 639</a>          For the symm ordering scheme, just do the top and right
<a name="line640"> 640</a>          boundary */</font>
<a name="line641"> 641</a> 
<a name="line642"> 642</a>       <font color="#444444">/* Processors at y = 0, neighbors of boundary nodes */</font>
<a name="line643"> 643</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line644"> 644</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line645"> 645</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line646"> 646</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font> <font color="4444FF">+</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line647"> 647</a> 
<a name="line648"> 648</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line649"> 649</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line650"> 650</a> 
<a name="line651"> 651</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">3</font><font color="4444FF">;</font>
<a name="line652"> 652</a> 
<a name="line653"> 653</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line654"> 654</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line655"> 655</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line656"> 656</a> 
<a name="line657"> 657</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line658"> 658</a>             <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#FF0000">1</font>,
<a name="line659"> 659</a>                                            <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line660"> 660</a> 
<a name="line661"> 661</a>          <font color="#444444">/* Eliminate the boundary conditions in b */</font>
<a name="line662"> 662</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line663"> 663</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#2040a0">i</font>,<font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">*</font> <font color="4444FF">(</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">B2</font>,<font color="#2040a0">i</font>,<font color="4444FF">-</font><font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line664"> 664</a> 
<a name="line665"> 665</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line666"> 666</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line667"> 667</a> 
<a name="line668"> 668</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line669"> 669</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line670"> 670</a> 
<a name="line671"> 671</a>          <font color="#444444">/* Note the use of AddToBoxValues (because we have already set values
<a name="line672"> 672</a>             at these nodes) */</font>
<a name="line673"> 673</a>          <font color="#2040a0">HYPRE_StructVectorAddToBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line674"> 674</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line675"> 675</a> 
<a name="line676"> 676</a>       <font color="#444444">/* Processors at x = 0, neighbors of boundary nodes */</font>
<a name="line677"> 677</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line678"> 678</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line679"> 679</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font> <font color="4444FF">+</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line680"> 680</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line681"> 681</a> 
<a name="line682"> 682</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line683"> 683</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line684"> 684</a> 
<a name="line685"> 685</a>          <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line686"> 686</a> 
<a name="line687"> 687</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line688"> 688</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line689"> 689</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line690"> 690</a> 
<a name="line691"> 691</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line692"> 692</a>             <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#FF0000">1</font>,
<a name="line693"> 693</a>                                            <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line694"> 694</a> 
<a name="line695"> 695</a>          <font color="#444444">/* Eliminate the boundary conditions in b */</font>
<a name="line696"> 696</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line697"> 697</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="4444FF">-</font><font color="#FF0000">1</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">*</font> <font color="4444FF">(</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">B1</font>,<font color="4444FF">-</font><font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line698"> 698</a> 
<a name="line699"> 699</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line700"> 700</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line701"> 701</a> 
<a name="line702"> 702</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line703"> 703</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line704"> 704</a> 
<a name="line705"> 705</a>          <font color="#2040a0">HYPRE_StructVectorAddToBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line706"> 706</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line707"> 707</a> 
<a name="line708"> 708</a>       <font color="#444444">/* Processors at y = 1, neighbors of boundary nodes */</font>
<a name="line709"> 709</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line710"> 710</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line711"> 711</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line712"> 712</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font> <font color="4444FF">+</font> <font color="4444FF">(</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line713"> 713</a> 
<a name="line714"> 714</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line715"> 715</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line716"> 716</a> 
<a name="line717"> 717</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line718"> 718</a>             <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">4</font><font color="4444FF">;</font>
<a name="line719"> 719</a>          <strong>else</strong>
<a name="line720"> 720</a>             <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">2</font><font color="4444FF">;</font>
<a name="line721"> 721</a> 
<a name="line722"> 722</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line723"> 723</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line724"> 724</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line725"> 725</a> 
<a name="line726"> 726</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#FF0000">1</font>,
<a name="line727"> 727</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line728"> 728</a> 
<a name="line729"> 729</a>          <font color="#444444">/* Eliminate the boundary conditions in b */</font>
<a name="line730"> 730</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line731"> 731</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">i</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#2040a0">i</font>,<font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">*</font> <font color="4444FF">(</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#2040a0">i</font>,<font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">B2</font>,<font color="#2040a0">i</font>,<font color="#FF0000">0.5</font><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line732"> 732</a> 
<a name="line733"> 733</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line734"> 734</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line735"> 735</a> 
<a name="line736"> 736</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line737"> 737</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line738"> 738</a> 
<a name="line739"> 739</a>          <font color="#2040a0">HYPRE_StructVectorAddToBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line740"> 740</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line741"> 741</a> 
<a name="line742"> 742</a>       <font color="#444444">/* Processors at x = 1, neighbors of boundary nodes */</font>
<a name="line743"> 743</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pi</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line744"> 744</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line745"> 745</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font> <font color="4444FF">+</font> <font color="4444FF">(</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font> <font color="4444FF">-</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line746"> 746</a>          <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line747"> 747</a> 
<a name="line748"> 748</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line749"> 749</a>          <font color="#2040a0">bc_iupper</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bc_ilower</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">+</font> <font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line750"> 750</a> 
<a name="line751"> 751</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">sym</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line752"> 752</a>             <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">2</font><font color="4444FF">;</font>
<a name="line753"> 753</a>          <strong>else</strong>
<a name="line754"> 754</a>             <font color="#2040a0">stencil_indices</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<a name="line755"> 755</a> 
<a name="line756"> 756</a>          <font color="#444444">/* Modify the matrix */</font>
<a name="line757"> 757</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line758"> 758</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line759"> 759</a> 
<a name="line760"> 760</a>          <font color="#2040a0">HYPRE_StructMatrixSetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">A</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#FF0000">1</font>,
<a name="line761"> 761</a>                                         <font color="#2040a0">stencil_indices</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line762"> 762</a> 
<a name="line763"> 763</a>          <font color="#444444">/* Eliminate the boundary conditions in b */</font>
<a name="line764"> 764</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line765"> 765</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">j</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">U0</font>,<font color="#FF0000">1</font>,<font color="#2040a0">j</font><font color="4444FF">)</font> <font color="4444FF">*</font> <font color="4444FF">(</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">K</font>,<font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">+</font><font color="#2040a0">bcEval</font><font color="4444FF">(</font><font color="#2040a0">B1</font>,<font color="#FF0000">0.5</font>,<font color="#2040a0">j</font><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line766"> 766</a> 
<a name="line767"> 767</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line768"> 768</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line769"> 769</a> 
<a name="line770"> 770</a>          <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">pj</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">N</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font>
<a name="line771"> 771</a>             <font color="#2040a0">bvalues</font><font color="4444FF">[</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#FF0000">0.0</font><font color="4444FF">;</font>
<a name="line772"> 772</a> 
<a name="line773"> 773</a>          <font color="#2040a0">HYPRE_StructVectorAddToBoxValues</font><font color="4444FF">(</font><font color="#2040a0">b</font>, <font color="#2040a0">bc_ilower</font>, <font color="#2040a0">bc_iupper</font>, <font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line774"> 774</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line775"> 775</a> 
<a name="line776"> 776</a>       <font color="#2040a0">free</font><font color="4444FF">(</font><font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line777"> 777</a>       <font color="#2040a0">free</font><font color="4444FF">(</font><font color="#2040a0">bvalues</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line778"> 778</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line779"> 779</a> 
<a name="line780"> 780</a>    <font color="#444444">/* Finalize the vector and matrix assembly */</font>
<a name="line781"> 781</a>    <font color="#2040a0">HYPRE_StructMatrixAssemble</font><font color="4444FF">(</font><font color="#2040a0">A</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line782"> 782</a>    <font color="#2040a0">HYPRE_StructVectorAssemble</font><font color="4444FF">(</font><font color="#2040a0">b</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line783"> 783</a>    <font color="#2040a0">HYPRE_StructVectorAssemble</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line784"> 784</a> 
<a name="line785"> 785</a>    <font color="#444444">/* 6. Set up and use a solver */</font>
<a name="line786"> 786</a>    <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font> <font color="#444444">/* SMG */</font>
<a name="line787"> 787</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line788"> 788</a>       <font color="#444444">/* Start timing */</font>
<a name="line789"> 789</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;SMG Setup&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line790"> 790</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line791"> 791</a> 
<a name="line792"> 792</a>       <font color="#444444">/* Options and setup */</font>
<a name="line793"> 793</a>       <font color="#2040a0">HYPRE_StructSMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line794"> 794</a>       <font color="#2040a0">HYPRE_StructSMGSetMemoryUse</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line795"> 795</a>       <font color="#2040a0">HYPRE_StructSMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">50</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line796"> 796</a>       <font color="#2040a0">HYPRE_StructSMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1.0e-06</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line797"> 797</a>       <font color="#2040a0">HYPRE_StructSMGSetRelChange</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line798"> 798</a>       <font color="#2040a0">HYPRE_StructSMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">n_pre</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line799"> 799</a>       <font color="#2040a0">HYPRE_StructSMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">n_post</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line800"> 800</a>       <font color="#2040a0">HYPRE_StructSMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line801"> 801</a>       <font color="#2040a0">HYPRE_StructSMGSetLogging</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line802"> 802</a>       <font color="#2040a0">HYPRE_StructSMGSetup</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line803"> 803</a> 
<a name="line804"> 804</a>       <font color="#444444">/* Finalize current timing */</font>
<a name="line805"> 805</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line806"> 806</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Setup phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line807"> 807</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line808"> 808</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line809"> 809</a> 
<a name="line810"> 810</a>       <font color="#444444">/* Start timing again */</font>
<a name="line811"> 811</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;SMG Solve&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line812"> 812</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line813"> 813</a> 
<a name="line814"> 814</a>       <font color="#444444">/* Solve */</font>
<a name="line815"> 815</a>       <font color="#2040a0">HYPRE_StructSMGSolve</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line816"> 816</a> 
<a name="line817"> 817</a>       <font color="#444444">/* Finalize current timing */</font>
<a name="line818"> 818</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line819"> 819</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Solve phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line820"> 820</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line821"> 821</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line822"> 822</a> 
<a name="line823"> 823</a>       <font color="#444444">/* Get info and release memory */</font>
<a name="line824"> 824</a>       <font color="#2040a0">HYPRE_StructSMGGetNumIterations</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">num_iterations</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line825"> 825</a>       <font color="#2040a0">HYPRE_StructSMGGetFinalRelativeResidualNorm</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">final_res_norm</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line826"> 826</a>       <font color="#2040a0">HYPRE_StructSMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line827"> 827</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line828"> 828</a> 
<a name="line829"> 829</a>    <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">)</font> <font color="#444444">/* PFMG */</font>
<a name="line830"> 830</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line831"> 831</a>       <font color="#444444">/* Start timing */</font>
<a name="line832"> 832</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;PFMG Setup&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line833"> 833</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line834"> 834</a> 
<a name="line835"> 835</a>       <font color="#444444">/* Options and setup */</font>
<a name="line836"> 836</a>       <font color="#2040a0">HYPRE_StructPFMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line837"> 837</a>       <font color="#2040a0">HYPRE_StructPFMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">50</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line838"> 838</a>       <font color="#2040a0">HYPRE_StructPFMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1.0e-06</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line839"> 839</a>       <font color="#2040a0">HYPRE_StructPFMGSetRelChange</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line840"> 840</a>       <font color="#2040a0">HYPRE_StructPFMGSetRAPType</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">rap</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line841"> 841</a>       <font color="#2040a0">HYPRE_StructPFMGSetRelaxType</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">relax</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line842"> 842</a>       <font color="#2040a0">HYPRE_StructPFMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">n_pre</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line843"> 843</a>       <font color="#2040a0">HYPRE_StructPFMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">n_post</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line844"> 844</a>       <font color="#2040a0">HYPRE_StructPFMGSetSkipRelax</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">skip</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line845"> 845</a>       <font color="#2040a0">HYPRE_StructPFMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line846"> 846</a>       <font color="#2040a0">HYPRE_StructPFMGSetLogging</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line847"> 847</a>       <font color="#2040a0">HYPRE_StructPFMGSetup</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line848"> 848</a> 
<a name="line849"> 849</a>       <font color="#444444">/* Finalize current timing */</font>
<a name="line850"> 850</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line851"> 851</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Setup phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line852"> 852</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line853"> 853</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line854"> 854</a> 
<a name="line855"> 855</a>       <font color="#444444">/* Start timing again */</font>
<a name="line856"> 856</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;PFMG Solve&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line857"> 857</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line858"> 858</a> 
<a name="line859"> 859</a>       <font color="#444444">/* Solve */</font>
<a name="line860"> 860</a>       <font color="#2040a0">HYPRE_StructPFMGSolve</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line861"> 861</a> 
<a name="line862"> 862</a>       <font color="#444444">/* Finalize current timing */</font>
<a name="line863"> 863</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line864"> 864</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Solve phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line865"> 865</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line866"> 866</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line867"> 867</a> 
<a name="line868"> 868</a>       <font color="#444444">/* Get info and release memory */</font>
<a name="line869"> 869</a>       <font color="#2040a0">HYPRE_StructPFMGGetNumIterations</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">num_iterations</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line870"> 870</a>       <font color="#2040a0">HYPRE_StructPFMGGetFinalRelativeResidualNorm</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">final_res_norm</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line871"> 871</a>       <font color="#2040a0">HYPRE_StructPFMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line872"> 872</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line873"> 873</a> 
<a name="line874"> 874</a>    <font color="#444444">/* Preconditioned CG */</font>
<a name="line875"> 875</a>    <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">&gt;</font> <font color="#FF0000">9</font><font color="4444FF">)</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">&lt;</font> <font color="#FF0000">20</font><font color="4444FF">)</font><font color="4444FF">)</font>
<a name="line876"> 876</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line877"> 877</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;PCG Setup&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line878"> 878</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line879"> 879</a> 
<a name="line880"> 880</a>       <font color="#2040a0">HYPRE_StructPCGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line881"> 881</a>       <font color="#2040a0">HYPRE_StructPCGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">200</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line882"> 882</a>       <font color="#2040a0">HYPRE_StructPCGSetTol</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1.0e-06</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line883"> 883</a>       <font color="#2040a0">HYPRE_StructPCGSetTwoNorm</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">1</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line884"> 884</a>       <font color="#2040a0">HYPRE_StructPCGSetRelChange</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">0</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line885"> 885</a>       <font color="#2040a0">HYPRE_StructPCGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#FF0000">2</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line886"> 886</a> 
<a name="line887"> 887</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">10</font><font color="4444FF">)</font>
<a name="line888"> 888</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line889"> 889</a>          <font color="#444444">/* use symmetric SMG as preconditioner */</font>
<a name="line890"> 890</a>          <font color="#2040a0">HYPRE_StructSMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line891"> 891</a>          <font color="#2040a0">HYPRE_StructSMGSetMemoryUse</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line892"> 892</a>          <font color="#2040a0">HYPRE_StructSMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line893"> 893</a>          <font color="#2040a0">HYPRE_StructSMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line894"> 894</a>          <font color="#2040a0">HYPRE_StructSMGSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line895"> 895</a>          <font color="#2040a0">HYPRE_StructSMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_pre</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line896"> 896</a>          <font color="#2040a0">HYPRE_StructSMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_post</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line897"> 897</a>          <font color="#2040a0">HYPRE_StructSMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line898"> 898</a>          <font color="#2040a0">HYPRE_StructSMGSetLogging</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line899"> 899</a>          <font color="#2040a0">HYPRE_StructPCGSetPrecond</font><font color="4444FF">(</font><font color="#2040a0">solver</font>,
<a name="line900"> 900</a>                                    <font color="#2040a0">HYPRE_StructSMGSolve</font>,
<a name="line901"> 901</a>                                    <font color="#2040a0">HYPRE_StructSMGSetup</font>,
<a name="line902"> 902</a>                                    <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line903"> 903</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line904"> 904</a> 
<a name="line905"> 905</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">11</font><font color="4444FF">)</font>
<a name="line906"> 906</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line907"> 907</a>          <font color="#444444">/* use symmetric PFMG as preconditioner */</font>
<a name="line908"> 908</a>          <font color="#2040a0">HYPRE_StructPFMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line909"> 909</a>          <font color="#2040a0">HYPRE_StructPFMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line910"> 910</a>          <font color="#2040a0">HYPRE_StructPFMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line911"> 911</a>          <font color="#2040a0">HYPRE_StructPFMGSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line912"> 912</a>          <font color="#2040a0">HYPRE_StructPFMGSetRAPType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">rap</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line913"> 913</a>          <font color="#2040a0">HYPRE_StructPFMGSetRelaxType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">relax</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line914"> 914</a>          <font color="#2040a0">HYPRE_StructPFMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_pre</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line915"> 915</a>          <font color="#2040a0">HYPRE_StructPFMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_post</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line916"> 916</a>          <font color="#2040a0">HYPRE_StructPFMGSetSkipRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">skip</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line917"> 917</a>          <font color="#2040a0">HYPRE_StructPFMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line918"> 918</a>          <font color="#2040a0">HYPRE_StructPFMGSetLogging</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line919"> 919</a>          <font color="#2040a0">HYPRE_StructPCGSetPrecond</font><font color="4444FF">(</font><font color="#2040a0">solver</font>,
<a name="line920"> 920</a>                                    <font color="#2040a0">HYPRE_StructPFMGSolve</font>,
<a name="line921"> 921</a>                                    <font color="#2040a0">HYPRE_StructPFMGSetup</font>,
<a name="line922"> 922</a>                                    <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line923"> 923</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line924"> 924</a> 
<a name="line925"> 925</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">17</font><font color="4444FF">)</font>
<a name="line926"> 926</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line927"> 927</a>          <font color="#444444">/* use two-step Jacobi as preconditioner */</font>
<a name="line928"> 928</a>          <font color="#2040a0">HYPRE_StructJacobiCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line929"> 929</a>          <font color="#2040a0">HYPRE_StructJacobiSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">2</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line930"> 930</a>          <font color="#2040a0">HYPRE_StructJacobiSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line931"> 931</a>          <font color="#2040a0">HYPRE_StructJacobiSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line932"> 932</a>          <font color="#2040a0">HYPRE_StructPCGSetPrecond</font><font color="4444FF">(</font> <font color="#2040a0">solver</font>,
<a name="line933"> 933</a>                                     <font color="#2040a0">HYPRE_StructJacobiSolve</font>,
<a name="line934"> 934</a>                                     <font color="#2040a0">HYPRE_StructJacobiSetup</font>,
<a name="line935"> 935</a>                                     <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line936"> 936</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line937"> 937</a> 
<a name="line938"> 938</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">18</font><font color="4444FF">)</font>
<a name="line939"> 939</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line940"> 940</a>          <font color="#444444">/* use diagonal scaling as preconditioner */</font>
<a name="line941"> 941</a>          <font color="#2040a0">precond</font> <font color="4444FF">=</font> <font color="#2040a0">NULL</font><font color="4444FF">;</font>
<a name="line942"> 942</a>          <font color="#2040a0">HYPRE_StructPCGSetPrecond</font><font color="4444FF">(</font><font color="#2040a0">solver</font>,
<a name="line943"> 943</a>                                    <font color="#2040a0">HYPRE_StructDiagScale</font>,
<a name="line944"> 944</a>                                    <font color="#2040a0">HYPRE_StructDiagScaleSetup</font>,
<a name="line945"> 945</a>                                    <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line946"> 946</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line947"> 947</a> 
<a name="line948"> 948</a>       <font color="#444444">/* PCG Setup */</font>
<a name="line949"> 949</a>       <font color="#2040a0">HYPRE_StructPCGSetup</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line950"> 950</a> 
<a name="line951"> 951</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line952"> 952</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Setup phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line953"> 953</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line954"> 954</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line955"> 955</a> 
<a name="line956"> 956</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;PCG Solve&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line957"> 957</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line958"> 958</a> 
<a name="line959"> 959</a>       <font color="#444444">/* PCG Solve */</font>
<a name="line960"> 960</a>       <font color="#2040a0">HYPRE_StructPCGSolve</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line961"> 961</a> 
<a name="line962"> 962</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line963"> 963</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Solve phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line964"> 964</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line965"> 965</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line966"> 966</a> 
<a name="line967"> 967</a>       <font color="#444444">/* Get info and release memory */</font>
<a name="line968"> 968</a>       <font color="#2040a0">HYPRE_StructPCGGetNumIterations</font><font color="4444FF">(</font> <font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">num_iterations</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line969"> 969</a>       <font color="#2040a0">HYPRE_StructPCGGetFinalRelativeResidualNorm</font><font color="4444FF">(</font> <font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">final_res_norm</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line970"> 970</a>       <font color="#2040a0">HYPRE_StructPCGDestroy</font><font color="4444FF">(</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line971"> 971</a> 
<a name="line972"> 972</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">10</font><font color="4444FF">)</font>
<a name="line973"> 973</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line974"> 974</a>          <font color="#2040a0">HYPRE_StructSMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line975"> 975</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line976"> 976</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">11</font> <font color="4444FF">)</font>
<a name="line977"> 977</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line978"> 978</a>          <font color="#2040a0">HYPRE_StructPFMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line979"> 979</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line980"> 980</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">17</font><font color="4444FF">)</font>
<a name="line981"> 981</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line982"> 982</a>          <font color="#2040a0">HYPRE_StructJacobiDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line983"> 983</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line984"> 984</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line985"> 985</a> 
<a name="line986"> 986</a>    <font color="#444444">/* Preconditioned GMRES */</font>
<a name="line987"> 987</a>    <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">&gt;</font> <font color="#FF0000">29</font><font color="4444FF">)</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">&lt;</font> <font color="#FF0000">40</font><font color="4444FF">)</font><font color="4444FF">)</font>
<a name="line988"> 988</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line989"> 989</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;GMRES Setup&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line990"> 990</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line991"> 991</a> 
<a name="line992"> 992</a>       <font color="#2040a0">HYPRE_StructGMRESCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line993"> 993</a> 
<a name="line994"> 994</a>       <font color="#444444">/* Note that GMRES can be used with all the interfaces - not
<a name="line995"> 995</a>          just the struct.  So here we demonstrate the
<a name="line996"> 996</a>          more generic GMRES interface functions. Since we have chosen
<a name="line997"> 997</a>          a struct solver then we must type cast to the more generic
<a name="line998"> 998</a>          HYPRE_Solver when setting options with these generic functions.
<a name="line999"> 999</a>          Note that one could declare the solver to be
<a name="line1000">1000</a>          type HYPRE_Solver, and then the casting would not be necessary.*/</font>
<a name="line1001">1001</a> 
<a name="line1002">1002</a>       <font color="#2040a0">HYPRE_GMRESSetMaxIter</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">HYPRE_Solver</font><font color="4444FF">)</font> <font color="#2040a0">solver</font>, <font color="#FF0000">500</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1003">1003</a>       <font color="#2040a0">HYPRE_GMRESSetKDim</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">HYPRE_Solver</font><font color="4444FF">)</font> <font color="#2040a0">solver</font>,<font color="#FF0000">30</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1004">1004</a>       <font color="#2040a0">HYPRE_GMRESSetTol</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">HYPRE_Solver</font><font color="4444FF">)</font> <font color="#2040a0">solver</font>, <font color="#FF0000">1.0e-06</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1005">1005</a>       <font color="#2040a0">HYPRE_GMRESSetPrintLevel</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">HYPRE_Solver</font><font color="4444FF">)</font> <font color="#2040a0">solver</font>, <font color="#FF0000">2</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1006">1006</a>       <font color="#2040a0">HYPRE_GMRESSetLogging</font><font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">HYPRE_Solver</font><font color="4444FF">)</font> <font color="#2040a0">solver</font>, <font color="#FF0000">1</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1007">1007</a> 
<a name="line1008">1008</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">30</font><font color="4444FF">)</font>
<a name="line1009">1009</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1010">1010</a>          <font color="#444444">/* use symmetric SMG as preconditioner */</font>
<a name="line1011">1011</a>          <font color="#2040a0">HYPRE_StructSMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1012">1012</a>          <font color="#2040a0">HYPRE_StructSMGSetMemoryUse</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1013">1013</a>          <font color="#2040a0">HYPRE_StructSMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1014">1014</a>          <font color="#2040a0">HYPRE_StructSMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1015">1015</a>          <font color="#2040a0">HYPRE_StructSMGSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1016">1016</a>          <font color="#2040a0">HYPRE_StructSMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_pre</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1017">1017</a>          <font color="#2040a0">HYPRE_StructSMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_post</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1018">1018</a>          <font color="#2040a0">HYPRE_StructSMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1019">1019</a>          <font color="#2040a0">HYPRE_StructSMGSetLogging</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1020">1020</a>          <font color="#2040a0">HYPRE_StructGMRESSetPrecond</font><font color="4444FF">(</font><font color="#2040a0">solver</font>,
<a name="line1021">1021</a>                                      <font color="#2040a0">HYPRE_StructSMGSolve</font>,
<a name="line1022">1022</a>                                      <font color="#2040a0">HYPRE_StructSMGSetup</font>,
<a name="line1023">1023</a>                                      <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1024">1024</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1025">1025</a> 
<a name="line1026">1026</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">31</font><font color="4444FF">)</font>
<a name="line1027">1027</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1028">1028</a>          <font color="#444444">/* use symmetric PFMG as preconditioner */</font>
<a name="line1029">1029</a>          <font color="#2040a0">HYPRE_StructPFMGCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1030">1030</a>          <font color="#2040a0">HYPRE_StructPFMGSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1031">1031</a>          <font color="#2040a0">HYPRE_StructPFMGSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1032">1032</a>          <font color="#2040a0">HYPRE_StructPFMGSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1033">1033</a>          <font color="#2040a0">HYPRE_StructPFMGSetRAPType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">rap</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1034">1034</a>          <font color="#2040a0">HYPRE_StructPFMGSetRelaxType</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">relax</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1035">1035</a>          <font color="#2040a0">HYPRE_StructPFMGSetNumPreRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_pre</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1036">1036</a>          <font color="#2040a0">HYPRE_StructPFMGSetNumPostRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">n_post</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1037">1037</a>          <font color="#2040a0">HYPRE_StructPFMGSetSkipRelax</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#2040a0">skip</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1038">1038</a>          <font color="#2040a0">HYPRE_StructPFMGSetPrintLevel</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1039">1039</a>          <font color="#2040a0">HYPRE_StructPFMGSetLogging</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1040">1040</a>          <font color="#2040a0">HYPRE_StructGMRESSetPrecond</font><font color="4444FF">(</font> <font color="#2040a0">solver</font>,
<a name="line1041">1041</a>                                       <font color="#2040a0">HYPRE_StructPFMGSolve</font>,
<a name="line1042">1042</a>                                       <font color="#2040a0">HYPRE_StructPFMGSetup</font>,
<a name="line1043">1043</a>                                       <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1044">1044</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1045">1045</a> 
<a name="line1046">1046</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">37</font><font color="4444FF">)</font>
<a name="line1047">1047</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1048">1048</a>          <font color="#444444">/* use two-step Jacobi as preconditioner */</font>
<a name="line1049">1049</a>          <font color="#2040a0">HYPRE_StructJacobiCreate</font><font color="4444FF">(</font><font color="#2040a0">MPI_COMM_WORLD</font>, <font color="4444FF">&amp;</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1050">1050</a>          <font color="#2040a0">HYPRE_StructJacobiSetMaxIter</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">2</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1051">1051</a>          <font color="#2040a0">HYPRE_StructJacobiSetTol</font><font color="4444FF">(</font><font color="#2040a0">precond</font>, <font color="#FF0000">0.0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1052">1052</a>          <font color="#2040a0">HYPRE_StructJacobiSetZeroGuess</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1053">1053</a>          <font color="#2040a0">HYPRE_StructGMRESSetPrecond</font><font color="4444FF">(</font> <font color="#2040a0">solver</font>,
<a name="line1054">1054</a>                                       <font color="#2040a0">HYPRE_StructJacobiSolve</font>,
<a name="line1055">1055</a>                                       <font color="#2040a0">HYPRE_StructJacobiSetup</font>,
<a name="line1056">1056</a>                                       <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1057">1057</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1058">1058</a> 
<a name="line1059">1059</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">38</font><font color="4444FF">)</font>
<a name="line1060">1060</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1061">1061</a>          <font color="#444444">/* use diagonal scaling as preconditioner */</font>
<a name="line1062">1062</a>          <font color="#2040a0">precond</font> <font color="4444FF">=</font> <font color="#2040a0">NULL</font><font color="4444FF">;</font>
<a name="line1063">1063</a>          <font color="#2040a0">HYPRE_StructGMRESSetPrecond</font><font color="4444FF">(</font> <font color="#2040a0">solver</font>,
<a name="line1064">1064</a>                                      <font color="#2040a0">HYPRE_StructDiagScale</font>,
<a name="line1065">1065</a>                                      <font color="#2040a0">HYPRE_StructDiagScaleSetup</font>,
<a name="line1066">1066</a>                                      <font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1067">1067</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1068">1068</a> 
<a name="line1069">1069</a>       <font color="#444444">/* GMRES Setup */</font>
<a name="line1070">1070</a>       <font color="#2040a0">HYPRE_StructGMRESSetup</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font> <font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1071">1071</a> 
<a name="line1072">1072</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1073">1073</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Setup phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1074">1074</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1075">1075</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1076">1076</a> 
<a name="line1077">1077</a>       <font color="#2040a0">time_index</font> <font color="4444FF">=</font> <font color="#2040a0">hypre_InitializeTiming</font><font color="4444FF">(</font><font color="#008000">&quot;GMRES Solve&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1078">1078</a>       <font color="#2040a0">hypre_BeginTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1079">1079</a> 
<a name="line1080">1080</a>       <font color="#444444">/* GMRES Solve */</font>
<a name="line1081">1081</a>       <font color="#2040a0">HYPRE_StructGMRESSolve</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="#2040a0">A</font>, <font color="#2040a0">b</font>, <font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1082">1082</a> 
<a name="line1083">1083</a>       <font color="#2040a0">hypre_EndTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1084">1084</a>       <font color="#2040a0">hypre_PrintTiming</font><font color="4444FF">(</font><font color="#008000">&quot;Solve phase times&quot;</font>, <font color="#2040a0">MPI_COMM_WORLD</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1085">1085</a>       <font color="#2040a0">hypre_FinalizeTiming</font><font color="4444FF">(</font><font color="#2040a0">time_index</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1086">1086</a>       <font color="#2040a0">hypre_ClearTiming</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1087">1087</a> 
<a name="line1088">1088</a>       <font color="#444444">/* Get info and release memory */</font>
<a name="line1089">1089</a>       <font color="#2040a0">HYPRE_StructGMRESGetNumIterations</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">num_iterations</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1090">1090</a>       <font color="#2040a0">HYPRE_StructGMRESGetFinalRelativeResidualNorm</font><font color="4444FF">(</font><font color="#2040a0">solver</font>, <font color="4444FF">&amp;</font><font color="#2040a0">final_res_norm</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1091">1091</a>       <font color="#2040a0">HYPRE_StructGMRESDestroy</font><font color="4444FF">(</font><font color="#2040a0">solver</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1092">1092</a> 
<a name="line1093">1093</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">30</font><font color="4444FF">)</font>
<a name="line1094">1094</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1095">1095</a>          <font color="#2040a0">HYPRE_StructSMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1096">1096</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1097">1097</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">31</font><font color="4444FF">)</font>
<a name="line1098">1098</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1099">1099</a>          <font color="#2040a0">HYPRE_StructPFMGDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1100">1100</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1101">1101</a>       <strong>else</strong> <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">solver_id</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">37</font><font color="4444FF">)</font>
<a name="line1102">1102</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1103">1103</a>          <font color="#2040a0">HYPRE_StructJacobiDestroy</font><font color="4444FF">(</font><font color="#2040a0">precond</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1104">1104</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1105">1105</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line1106">1106</a> 
<a name="line1107">1107</a>    <font color="#444444">/* Save the solution for GLVis visualization, see vis/glvis-ex4.sh */</font>
<a name="line1108">1108</a>    <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">vis</font><font color="4444FF">)</font>
<a name="line1109">1109</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line1110">1110</a>       <font color="#2040a0">FILE</font> <font color="4444FF">*</font><font color="#2040a0">file</font><font color="4444FF">;</font>
<a name="line1111">1111</a>       <strong>char</strong> <font color="#2040a0">filename</font><font color="4444FF">[</font><font color="#FF0000">255</font><font color="4444FF">]</font><font color="4444FF">;</font>
<a name="line1112">1112</a> 
<a name="line1113">1113</a>       <strong>int</strong> <font color="#2040a0">nvalues</font> <font color="4444FF">=</font> <font color="#2040a0">n</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">;</font>
<a name="line1114">1114</a>       <strong>double</strong> <font color="4444FF">*</font><font color="#2040a0">values</font> <font color="4444FF">=</font> <font color="#2040a0">calloc</font><font color="4444FF">(</font><font color="#2040a0">nvalues</font>, <strong>sizeof</strong><font color="4444FF">(</font><strong>double</strong><font color="4444FF">)</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1115">1115</a> 
<a name="line1116">1116</a>       <font color="#444444">/* get the local solution */</font>
<a name="line1117">1117</a>       <font color="#2040a0">HYPRE_StructVectorGetBoxValues</font><font color="4444FF">(</font><font color="#2040a0">x</font>, <font color="#2040a0">ilower</font>, <font color="#2040a0">iupper</font>, <font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1118">1118</a> 
<a name="line1119">1119</a>       <font color="#2040a0">sprintf</font><font color="4444FF">(</font><font color="#2040a0">filename</font>, <font color="#008000">&quot;%s.%06d&quot;</font>, <font color="#008000">&quot;vis/ex4.sol&quot;</font>, <font color="#2040a0">myid</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1120">1120</a>       <strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">file</font> <font color="4444FF">=</font> <font color="#2040a0">fopen</font><font color="4444FF">(</font><font color="#2040a0">filename</font>, <font color="#008000">&quot;w&quot;</font><font color="4444FF">)</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">NULL</font><font color="4444FF">)</font>
<a name="line1121">1121</a>       <font color="4444FF"><strong>{</strong></font>
<a name="line1122">1122</a>          <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;Error: can't open output file %s<font color="#77dd77">\n</font>&quot;</font>, <font color="#2040a0">filename</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1123">1123</a>          <font color="#2040a0">MPI_Finalize</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1124">1124</a>          <font color="#2040a0">exit</font><font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1125">1125</a>       <font color="4444FF"><strong>}</strong></font>
<a name="line1126">1126</a> 
<a name="line1127">1127</a>       <font color="#444444">/* save solution with global unknown numbers */</font>
<a name="line1128">1128</a>       <font color="#2040a0">k</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<a name="line1129">1129</a>       <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">j</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">j</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">j</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line1130">1130</a>          <strong>for</strong> <font color="4444FF">(</font><font color="#2040a0">i</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font> <font color="#2040a0">i</font> <font color="4444FF">&lt;</font> <font color="#2040a0">n</font><font color="4444FF">;</font> <font color="#2040a0">i</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">)</font>
<a name="line1131">1131</a>             <font color="#2040a0">fprintf</font><font color="4444FF">(</font><font color="#2040a0">file</font>, <font color="#008000">&quot;%06d %.14e<font color="#77dd77">\n</font>&quot;</font>, <font color="#2040a0">pj</font><font color="4444FF">*</font><font color="#2040a0">N</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">+</font><font color="#2040a0">pi</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">+</font><font color="#2040a0">j</font><font color="4444FF">*</font><font color="#2040a0">N</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">+</font><font color="#2040a0">i</font>, <font color="#2040a0">values</font><font color="4444FF">[</font><font color="#2040a0">k</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="4444FF">]</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1132">1132</a> 
<a name="line1133">1133</a>       <font color="#2040a0">fflush</font><font color="4444FF">(</font><font color="#2040a0">file</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1134">1134</a>       <font color="#2040a0">fclose</font><font color="4444FF">(</font><font color="#2040a0">file</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1135">1135</a>       <font color="#2040a0">free</font><font color="4444FF">(</font><font color="#2040a0">values</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1136">1136</a> 
<a name="line1137">1137</a>       <font color="#444444">/* save global finite element mesh */</font>
<a name="line1138">1138</a>       <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line1139">1139</a>          <font color="#2040a0">GLVis_PrintGlobalSquareMesh</font><font color="4444FF">(</font><font color="#008000">&quot;vis/ex4.mesh&quot;</font>, <font color="#2040a0">N</font><font color="4444FF">*</font><font color="#2040a0">n</font><font color="4444FF">-</font><font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1140">1140</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line1141">1141</a> 
<a name="line1142">1142</a>    <strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">myid</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<a name="line1143">1143</a>    <font color="4444FF"><strong>{</strong></font>
<a name="line1144">1144</a>       <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1145">1145</a>       <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;Iterations = %d<font color="#77dd77">\n</font>&quot;</font>, <font color="#2040a0">num_iterations</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1146">1146</a>       <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;Final Relative Residual Norm = %e<font color="#77dd77">\n</font>&quot;</font>, <font color="#2040a0">final_res_norm</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1147">1147</a>       <font color="#2040a0">printf</font><font color="4444FF">(</font><font color="#008000">&quot;<font color="#77dd77">\n</font>&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1148">1148</a>    <font color="4444FF"><strong>}</strong></font>
<a name="line1149">1149</a> 
<a name="line1150">1150</a>    <font color="#444444">/* Free memory */</font>
<a name="line1151">1151</a>    <font color="#2040a0">HYPRE_StructGridDestroy</font><font color="4444FF">(</font><font color="#2040a0">grid</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1152">1152</a>    <font color="#2040a0">HYPRE_StructStencilDestroy</font><font color="4444FF">(</font><font color="#2040a0">stencil</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1153">1153</a>    <font color="#2040a0">HYPRE_StructMatrixDestroy</font><font color="4444FF">(</font><font color="#2040a0">A</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1154">1154</a>    <font color="#2040a0">HYPRE_StructVectorDestroy</font><font color="4444FF">(</font><font color="#2040a0">b</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1155">1155</a>    <font color="#2040a0">HYPRE_StructVectorDestroy</font><font color="4444FF">(</font><font color="#2040a0">x</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1156">1156</a> 
<a name="line1157">1157</a>    <font color="#444444">/* Finalize MPI */</font>
<a name="line1158">1158</a>    <font color="#2040a0">MPI_Finalize</font><font color="4444FF">(</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1159">1159</a> 
<a name="line1160">1160</a>    <strong>return</strong> <font color="4444FF">(</font><font color="#FF0000">0</font><font color="4444FF">)</font><font color="4444FF">;</font>
<a name="line1161">1161</a> <font color="4444FF"><strong>}</strong></font>

</pre>
<hr>
syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
</body>
</html>
